<?xml version="1.0" encoding="UTF-8" ?>

<sqlMap namespace="Order" 
xmlns="http://ibatis.apache.org/mapping" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

	<alias>
		<typeAlias alias="Order" type="MyBatis.DataMapper.Sqlite.Test.Domain.Order, MyBatis.DataMapper.Sqlite.Test" />
	</alias>

		<!-- If the type is not specified, ADO.NET infers the 
			  data provider Type of the Parameter from the Value property 
			  of the Parameter object. -->

	<resultMaps>

    <resultMap id="base-order-result" class="Order">
      <result property="Id"         column="Order_ID"/>
      <result property="Date"       column="Order_Date"/>
      <result property="CardExpiry" column="Order_CardExpiry"/>
      <result property="CardType"   column="Order_CardType"/>
      <result property="CardNumber" column="Order_CardNumber"/>
      <result property="Street"     column="Order_Street"/>
      <result property="City"       column="Order_City"/>
      <result property="Province"   column="Order_Province"/>
      <result property="PostalCode" column="Order_PostalCode"/>
    </resultMap>

    <resultMap id="order-result-suffix" class="Order" extends="base-order-result" suffix="_suffix" />
    <resultMap id="order-result-prefix" class="Order" extends="base-order-result" prefix="prefix_" />

    <resultMap id="order-result-circular" extends="base-order-result" class="Order">
      <result property="Account" resultMapping="Account.account-constructor-circular"/>
    </resultMap>
    
		<resultMap id="order-result-constructor1" class="Order" >
			<constructor>
				<argument argumentName="id"		 column="Order_ID"/>
				<argument argumentName="account" resultMapping="Account.account-result-nullable-email" />
			</constructor>
			<result property="Date"       column="Order_Date"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>  
		
		<resultMap id="order-result-constructor2"  class="Order" >
			<constructor>
				<argument argumentName="id"		 column="Order_ID"/>
				<argument argumentName="account" column="Account_ID" select="GetAccountViaColumnName" />
			</constructor>
			<result property="Date"       column="Order_Date"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>  
		
		<resultMap id="order-result-constructor3"  class="Order" >
			<constructor>
				<argument argumentName="id"		 column="Order_ID"/>
				<argument argumentName="account" column="Account_ID" select="GetAccountViaColumnName" />
				<argument argumentName="lineItems"	column="Order_ID" select="GetLineItemsForOrder" />	
			</constructor>
			<result property="Date"       column="Order_Date"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>
    
		<resultMap id="order-result-constructor4"  class="Order" >
			<constructor>
				<argument argumentName="id"		 column="Order_ID"/>
				<argument argumentName="account" column="Account_ID" select="GetAccountViaColumnName" />
				<argument argumentName="lineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
			</constructor>
			<result property="Date"       column="Order_Date"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>

		<resultMap id="order-result-constructor5"  class="Order" >
			<constructor>
				<argument argumentName="id"		 column="Order_ID"/>
				<argument argumentName="account" column="Account_ID" select="GetAccountViaColumnName" />
				<argument argumentName="collection" column="Order_ID"  select="GetLineItemsForOrderWithListClass" />
			</constructor>
			<result property="Date"       column="Order_Date"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>
    
		<resultMap id="order-result-constructor6" extends="base-order-result" class="Order" >
			<constructor>
				<argument argumentName="lineItems" column="Order_ID"  select="GetLineItemsForOrderWithListClass2" />
			</constructor>
		</resultMap>

    <resultMap id="order-result-constructor7" extends="base-order-result" class="Order" >
      <constructor>
        <argument argumentName="collection" column="Order_ID"  select="GetLineItemsForOrderWithListClass2" />
      </constructor>
    </resultMap>
    
    <resultMap id="order-result-constructor8" extends="base-order-result" class="Order" >
		<constructor>
			<argument argumentName="id"		 column="Order_ID"/>
			<argument argumentName="account" resultMapping="Account.account-result-constructor" />
		</constructor>
	</resultMap>

    <resultMap id="order-result-constructor9" class="Order" >
      <constructor>
        <argument argumentName="id"		 column="Order_ID"/>
        <argument argumentName="account" resultMapping="Account.account-result-constructor2" />
      </constructor>
      <result property="Date"       column="Order_Date"/>
      <result property="CardExpiry" column="Order_CardExpiry"/>
      <result property="CardType"   column="Order_CardType"/>
      <result property="CardNumber" column="Order_CardNumber"/>
      <result property="Street"     column="Order_Street"/>
      <result property="City"       column="Order_City"/>
      <result property="Province"   column="Order_Province"/>
      <result property="PostalCode" column="Order_PostalCode"/>
    </resultMap>

    <resultMap id="order-JIRA182"  class="Order" >
      <result property="Id"       column="Order_ID"/>
      <result property="Account"  column="Account_ID" lazyLoad="true" select="GetAccountViaColumnName"/>
      <result property="Date"       column="Order_Date"/>
      <result property="CardExpiry" column="Order_CardExpiry"/>
      <result property="CardType"   column="Order_CardType"/>
      <result property="CardNumber" column="Order_CardNumber"/>
      <result property="Street"     column="Order_Street"/>
      <result property="City"       column="Order_City"/>
      <result property="Province"   column="Order_Province"/>
      <result property="PostalCode" column="Order_PostalCode"/>
    </resultMap>
    
    <resultMap id="credit-card-result" class="string">
			<result property="value" column="Order_CardNumber"/>
		</resultMap>

		<resultMap id="lite-order-result-by-name" class="Order">
			<result property="Id"         column="Order_ID"/>
			<result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
		</resultMap>
    
		<resultMap id="order-with-generic-list-lineitem" class="Order" 
				extends="lite-order-result-by-name" >
			<result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder" />
		</resultMap>

    <resultMap id="order-with-generic-lazy-load" class="Order" 
      extends="lite-order-result-by-name" >
      <result property="LineItemsGenericList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder" />
      <result property="GenericListAccount" lazyLoad="true" column="Order_ID" select="SelectGenericList" />

    </resultMap>

		<resultMap id="order-with-generic-collection-lineitem" class="Order" 
				extends="lite-order-result-by-name" >
			<result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrderWithListClass2" />
		</resultMap>

    <resultMap id="order-and-generic-collection-lineitem" class="Order"
    extends="lite-order-result-by-name" >
      <result property="GenericListLineItem" column="Order_ID" select="GetLineItemsForOrderWithGenericList" />
    </resultMap>
    
    <resultMap id="order-with-generic-typed-collection-lineitem" class="Order" 
      extends="lite-order-result-by-name" >
      <result property="LineItemsCollection2" column="Order_ID" select="GetLineItemsForOrderWithListClass2" />
    </resultMap>

    <resultMap id="order-with-generic-typed-collection-lineitem-lazy" class="Order" 
      extends="lite-order-result-by-name" >
      <result property="LineItemsCollection2" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrderWithListClass2" />
    </resultMap>
    
		<resultMap id="order-with-generic-collection-via-sp" class="Order" 
			extends="lite-order-result-by-name" >
			<result property="LineItemsCollection" column="Order_ID" select="SelectLineItemForOrder" />
		</resultMap>

		<resultMap id="order-with-lines-result" class="Order" 
								extends="lite-order-result-by-name" >
			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder" />
		</resultMap>

    <resultMap id="order-JIAR220" class="Order"
            extends="lite-order-result-by-name" >
      <result property="LineItemsIList" column="Order_ID" select="GetLineItemsForOrder" />
    </resultMap>

    <resultMap id="order-with-generic-lines-result" class="Order" 
            extends="lite-order-result-by-name" >
      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrderWithListClass2" />
    </resultMap>

    <resultMap id="order-with-generic-lines-result-lazy" class="Order" 
        extends="lite-order-result-by-name" >
      <result property="LineItemsGenericList" column="Order_ID" lazyLoad="true" select="GetLineItemsForOrderWithListClass2" />
    </resultMap>

    <resultMap id="order-and-generic-lines-result-lazy" class="Order"
          extends="lite-order-result-by-name" >
      <result property="GenericListLineItem" column="Order_ID" lazyLoad="true" select="GetLineItemsForOrderWithGenericList" />
    </resultMap>
    
    <resultMap id="order-with-generic-collection" class="Order" 
            extends="lite-order-result-by-name" >
      <result property="LineItemsCollection2" column="Order_ID" select="GetLineItemsForOrderWithListClass2" />
    </resultMap>
    
		<resultMap id="order-with-lines-result-statement-namespaces" class="Order" 
								extends="lite-order-result-by-name" >
			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="LineItem.GetLineItemsForOrder" />
		</resultMap>

		<resultMap id="order-with-lines-collection" class="Order"
								extends="lite-order-result-by-name" >
			<result property="LineItemsCollection" column="Order_ID"  lazyLoad="true" select="GetLineItemsForOrderWithListClass" />
		</resultMap>

		<resultMap id="order-with-lines-array" class="Order"
								extends="lite-order-result-by-name">
			<result property="LineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
		</resultMap>

		<resultMap id="lite-order-map-result" class="Hashtable">
			<result property="Id"         type="Int" column="Order_ID"/>
			<result property="Date"       type="date" column="Order_Date"/>
			<result property="CardExpiry" type="string" column="Order_CardExpiry"/>
			<result property="CardType"   type="string" column="Order_CardType"/>
			<result property="CardNumber" type="string" column="Order_CardNumber"/>
			<result property="Street"     type="string" column="Order_Street"/>
			<result property="City"       type="string" column="Order_City"/>
			<result property="Province"   type="string" column="Order_Province"/>
			<result property="PostalCode" type="string" column="Order_PostalCode"/>
		</resultMap>
  
	
		<resultMap id="order-hash" class="Hashtable">
			<result property="Date" column="Order_Date" nullValue="01/01/0001 00:00:00"/>
		</resultMap>
		
		<resultMap id="order-with-types-result" class="Order">
			<result property="Id"         column="Order_ID"			dbType="VarNumeric"/><!-- Int for SqlClient, Obdc; Integer for Oledb -->
			<result property="Date"       column="Order_Date"		dbType="DateTime "/>
			<result property="CardExpiry" column="Order_CardExpiry" dbType="String"/>
			<result property="CardType"   column="Order_CardType"	dbType="String"/>
			<result property="CardNumber" column="Order_CardNumber" dbType="String"/>
			<result property="Street"     column="Order_Street"		dbType="String"/>
			<result property="City"       column="Order_City"		dbType="String"/>
			<result property="Province"   column="Order_Province"	dbType="String"/>
			<result property="PostalCode" column="Order_PostalCode" dbType="String"/>
		</resultMap>
		
		<resultMap id="lite-order-result-by-index" class="Order">
			<result property="Id"         column="Order_ID"			columnIndex="0"/>
			<result property="Date"       column="Order_Date"		columnIndex="1" />
			<result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
			<result property="CardType"   column="Order_CardType"	columnIndex="3" />
			<result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
			<result property="Street"     column="Order_Street"		columnIndex="5" />
			<result property="City"       column="Order_City"		columnIndex="6" />
			<result property="Province"   column="Order_Province"	columnIndex="7"/>
			<result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
		</resultMap>
    
		<resultMap id="order-with-account-result" extends="base-order-result" class="Order">
			<result property="Account"    column="Account_ID" select="GetAccountViaColumnName" />
		</resultMap>
		
		<resultMap id="order-with-sp-account-result" extends="base-order-result" class="Order">
			<result property="Account"    column="Account_ID=Account_ID" select="GetAccountViaSP0" />
		</resultMap>
		
		<resultMap id="order-with-collection-result" extends="base-order-result" class="Order">
			<result property="LineItemsIList"	column="Order_ID" select="GetLineItemsForOrder" />	
			<result property="LineItemsCollection"		column="Order_ID" select="GetLineItemsForOrder" lazyLoad="false" />
		</resultMap>
		
		<resultMap id="order-with-favourite-line-item" extends="base-order-result" class="Order">
			<result property="FavouriteLineItem"	column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem" select="GetSpecificLineItem" />
		</resultMap>
		
		<resultMap id="order-joined-favourite2" extends="base-order-result" class="Order">
      <result property="FavouriteLineItem.Id" column="LineItem_ID"/>
      <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
      <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
      <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
    </resultMap>

    <resultMap id="order-with-dyn-favourite-line-item" extends="base-order-result" class="Order">
			<result property="FavouriteLineItem"	
						column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem" 
						select="GetDynSpecificLineItem" />
		</resultMap>
		
		<resultMap id="order-joined-favourite" extends="base-order-result" class="Order">
			<result property="FavouriteLineItem"	resultMapping="LineItem.LineItem" />
		</resultMap>
		
		<resultMap id="order-joined-with-account" class="Order">
			<result property="Id"         column="Order_ID"/>
			<result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
			<result property="Account"	resultMapping="Account.account-result-nullable-email" />
		</resultMap>
		
		<resultMap id="order-joined-with-account-constructor" class="Order">
			<result property="Id"         column="Order_ID"/>
			<result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
			<result property="CardExpiry" column="Order_CardExpiry"/>
			<result property="CardType"   column="Order_CardType"/>
			<result property="CardNumber" column="Order_CardNumber"/>
			<result property="Street"     column="Order_Street"/>
			<result property="City"       column="Order_City"/>
			<result property="Province"   column="Order_Province"/>
			<result property="PostalCode" column="Order_PostalCode"/>
			<result property="Account"	resultMapping="Account.account-result-constructor" />
		</resultMap>

    <resultMap id="order-with-favourite-line-item-JIRA-251" extends="base-order-result" class="Order">
      <result property="FavouriteLineItem"	column="Order_ID,Order_FavouriteLineItem" select="GetSpecificLineItem-JIRA-251" />
    </resultMap>
    
  </resultMaps>  
	
	<statements>

    <select id="GetOrderWithPrefix" resultMap="order-result-prefix" >
      SELECT
        Order_ID As prefix_Order_ID,
        Order_Date As prefix_Order_Date,
        Order_CardExpiry As prefix_Order_CardExpiry,
        Order_CardType As prefix_Order_CardType,
        Order_CardNumber As prefix_Order_CardNumber,
        Order_Street As prefix_Order_Street,
        Order_City As prefix_Order_City,
        Order_Province As prefix_Order_Province,
        Order_PostalCode As prefix_Order_PostalCode
      FROM
      Orders
    </select>

    <select id="GetOrderWithSuffix" resultMap="order-result-suffix" >
      SELECT
      Order_ID As Order_ID_suffix,
      Order_Date As Order_Date_suffix,
      Order_CardExpiry As Order_CardExpiry_suffix,
      Order_CardType As Order_CardType_suffix,
      Order_CardNumber As Order_CardNumber_suffix,
      Order_Street As Order_Street_suffix,
      Order_City As Order_City_suffix,
      Order_Province As Order_Province_suffix,
      Order_PostalCode As Order_PostalCode_suffix
      FROM
      Orders
    </select>
    
    <select id="GetOrderWithAcccount"
        resultMap="order-result-circular" >
          SELECT
          *
          FROM
          Orders o
          JOIN
          Accounts a
          ON
          o.Account_Id = A.Account_Id
    </select>

    <!-- <select id="GetOrderJoinWithNoLineItem"
			parameterClass="Int"
			resultMap="order-joined-nolineitem">
			select * 
			from Orders LEFT OUTER JOIN
			LineItems ON Orders.Order_ID = LineItems.Order_ID 
						AND Orders.Order_FavouriteLineItem = LineItems.LineItem_ID
			WHERE     Orders.Order_ID = #value#
		</select>-->

    <statement id="GetOrderWithFavouriteLineItem-JIRA-251"
        parameterClass="int"
        resultMap="order-with-favourite-line-item-JIRA-251" >
      select * from Orders where Order_ID = #value#
    </statement>
    
    <statement id="GetOrderWithGenericLineItems"
      parameterClass="Integer"
      resultMap="order-with-generic-lines-result" >
      select * from Orders where Order_ID = #value#
    </statement>

    <statement id="GetOrderWithGenericLineItemsLazy"
      parameterClass="Integer"
      resultMap="order-with-generic-lines-result-lazy" >
      select * from Orders where Order_ID = #value#
    </statement>

    <statement id="GetOrderGenericLineItemsLazy"
      parameterClass="Integer"
      resultMap="order-and-generic-lines-result-lazy" >
      select * from Orders where Order_ID = #value#
    </statement>
    
    <statement id="GetOrderWithGenericLazyLoad"
      parameterClass="Integer"
      resultMap="order-with-generic-lazy-load" >
      select * from Orders where Order_ID = #value#
    </statement>
    
   
		<statement id="GetOrderWithGenericListLineItem"
		  parameterClass="Integer"
		  resultMap="order-with-generic-list-lineitem" >
			select * from Orders where Order_ID = #value#
		</statement>
	    
		<statement id="GetOrderWithGenericLineItemCollection"
		  parameterClass="Integer"
		  resultMap="order-with-generic-collection-lineitem" >
			select * from Orders where Order_ID = #value#
		</statement>

    <statement id="GetOrderGenericListLineItem"
      parameterClass="Integer"
      resultMap="order-and-generic-collection-lineitem" >
      select * from Orders where Order_ID = #value#
    </statement>
    
    <statement id="GetOrderWithGenericTypedLineItemCollection"
      parameterClass="Integer"
      resultMap="order-with-generic-typed-collection-lineitem" >
      select * from Orders where Order_ID = #value#
    </statement>

    <statement id="GetOrderWithGenericTypedLineItemCollectionLazy"
     parameterClass="Integer"
     resultMap="order-with-generic-typed-collection-lineitem-lazy" >
      select * from Orders where Order_ID = #value#
    </statement>
    
		<statement id="GetOrderWithGenericViaSP"
		parameterClass="Integer"
		resultMap="order-with-generic-collection-via-sp" >
			select * from Orders where Order_ID = #value#
		</statement>
    
		<statement id="GetOrderLiteByColumnName"
					parameterClass="Int"
					resultMap="lite-order-result-by-name" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderByHashTable"
					parameterClass="Int"
					resultMap="order-hash" >
			select Order_Date from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderLiteByColumnIndex"
					parameterClass="Int"
					resultMap="lite-order-result-by-index" >
			select
			Order_ID,
			Order_Date,
			Order_CardExpiry,
			Order_CardType,
			Order_CardNumber,
			Order_Street,
			Order_City,
			Order_Province,
			Order_PostalCode
			from Orders where Order_ID = #value#
		</statement>
					
		<statement id="GetOrderWithTypes"
					parameterClass="Int"
					resultMap="order-with-types-result" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithLineItems"
					parameterClass="Integer"
					resultMap="order-with-lines-result" >
			select * from Orders where Order_ID = #value#
		</statement>

		<statement id="GetOrderWithGenricListLineItem"
		    parameterClass="Integer"
		    resultMap="order-with-generic-list-lineitem" >
			select * from Orders where Order_ID = #value#
		</statement>
    
		<statement id="GetOrderWithLineItemsUsingStatementNamespaces"
					parameterClass="Integer"
					resultMap="order-with-lines-result-statement-namespaces" >
			select * from Orders where Order_ID = #value#
		</statement>		

		<statement id="GetAllOrderWithLineItems"
					resultMap="order-with-lines-result" >
			select * from Orders
		</statement>

    <statement id="JIAR220"
      resultMap="order-JIAR220" >
      select * from Orders
    </statement>
    
		<statement id="GetOrderCardExpiryViaResultClass"
					parameterClass="int"
					resultClass="date">
			select
			Order_Date
			from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithAccount"
					parameterClass="int"
					resultMap="order-with-account-result" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithAccountViaSP"
					parameterClass="int"
					resultMap="order-with-sp-account-result" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithLineItemsCollection"
					parameterClass="Integer"
					resultMap="order-with-collection-result" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		 <statement id="GetOrderJoinedFavourite"
                    parameterClass="Integer"
                    resultMap="order-joined-favourite" >
			select * from Orders, LineItems
			where Orders.Order_ID = LineItems.Order_ID
			and Order_FavouriteLineItem = LineItems.LineItem_ID
			and Orders.Order_ID = #value#
		</statement>
		
		<statement id="GetOrderJoinedFavourite2"
                    parameterClass="Integer"
                    resultMap="order-joined-favourite2" >
			select * from Orders, LineItems
			where Orders.Order_ID = LineItems.Order_ID
			and Order_FavouriteLineItem = LineItems.LineItem_ID
			and Orders.Order_ID = #value#
		</statement>

		<statement id="GetOrderJoinedFavourite3"
                    parameterClass="Integer"
                    resultClass="Order" >
			select 
				Orders.Order_ID as Id,
				Order_Date as Date,
				Order_CardExpiry as CardExpiry,
				Order_CardType as CardType,
				Order_CardNumber as CardNumber,
				Order_Street as Street,
				Order_City as City,
				Order_Province as Province,
				Order_PostalCode as PostalCode,
				LineItem_ID as "FavouriteLineItem.Id",
				LineItem_Code as "FavouriteLineItem.Code",
				LineItem_Quantity as "FavouriteLineItem.Quantity",
				LineItem_Price as "FavouriteLineItem.Price"
			from Orders, LineItems
			where Orders.Order_ID = LineItems.Order_ID
			and Order_FavouriteLineItem = LineItems.LineItem_ID
			and Orders.Order_ID = #value#
		</statement>
											
		<statement id="GetOrderWithFavouriteLineItem"
					parameterClass="int"
					resultMap="order-with-favourite-line-item" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithLineItemCollection"
					parameterClass="int"
					resultMap="order-with-lines-collection" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderAsHastable"
					parameterClass="Integer"
					resultMap="lite-order-map-result" >
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderWithLineItemArray"
				parameterClass="int"
				resultMap="order-with-lines-array">
				select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetAllCreditCardNumbersFromOrders"
				resultMap="credit-card-result" >
			select distinct Order_CardNumber from Orders
			order by Order_CardNumber
		</statement>
		
		<statement id="InsertOrderViaParameterMap"
                    parameterMap="insert-params" >
			insert into Orders  
				(Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType, 
					Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode ) 
			values 
				(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
		</statement>
		
		<statement id="InsertOrderViaPublicFields">
			insert into Orders  
				(Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType, 
					Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode ) 
			values 
				(#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
		</statement>		
		
		<statement id="InsertOrderViaExtendParameterMap"
                    parameterMap="insert-extend" >
			insert into Orders  
				(Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType, 
					Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode ) 
			values 
				(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
		</statement>	
		
		<select id="GetOrderWithDynFavouriteLineItem"
				parameterClass="Integer"
				resultMap="order-with-dyn-favourite-line-item">
			select * from Orders where Order_ID = #value#
		</select>			
		
		<select id="SelectOrderByDate"
				parameterClass="Hashtable"
				resultMap="lite-order-result-by-name">
			select * from Orders where Order_Date = #Foo#
		</select>	
		
		<select id="SelectOrderByDateDynamic"
				parameterClass="Hashtable"
				resultMap="lite-order-result-by-name">
			select * from Orders
			where 1=1
			<isNotEmpty prepend="AND" property="Foo"> 
				(Order_Date = '$Foo$') 
			</isNotEmpty> 
		</select>	
				
		<select id="GetAccountJIRA45"
				parameterClass="int"
				resultMap="Account.indexed-account-result">
			select
			Account_ID,
			Account_FirstName,
			Account_LastName,
			Account_Email
			from Accounts
			where Account_ID = #value#
		</select>
		
		<select id="GetOrderJoinWithAccount"
				parameterClass="Integer"
				resultMap="order-joined-with-account">
			select 
				Order_ID, 
				Order_Date, 
				Order_CardExpiry, 
				Order_CardType,
				Order_CardNumber, 
				Order_Street, 
				Order_City, 
				Order_Province, 
				Order_PostalCode,
				acc.Account_ID,
				acc.Account_FirstName,
				acc.Account_LastName,
				acc.Account_Email 
			from Orders as ord
			LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
			where Order_ID = #value#
		</select>
		
		<select id="GetOrderConstructor1"
				parameterClass="Integer"
				resultMap="order-result-constructor1">
			select 
				Order_ID, 
				Order_Date, 
				Order_CardExpiry, 
				Order_CardType,
				Order_CardNumber, 
				Order_Street, 
				Order_City, 
				Order_Province, 
				Order_PostalCode,
				acc.Account_ID,
				acc.Account_FirstName,
				acc.Account_LastName,
				acc.Account_Email 
			from Orders as ord
			LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
			where Order_ID = #value#
		</select>	
		
		<statement id="GetOrderConstructor2"
					parameterClass="int"
					resultMap="order-result-constructor2">
			select * from Orders where Order_ID = #value#
		</statement>
		
		<statement id="GetOrderConstructor3"
					parameterClass="int"
					resultMap="order-result-constructor3">
			select * from Orders where Order_ID = #value#
		</statement>

    <statement id="GetManyOrderWithConstructor"
					resultMap="order-result-constructor3">
      select * from Orders
    </statement>
		
		<statement id="GetOrderConstructor4"
					parameterClass="int"
					resultMap="order-result-constructor4">
			select * from Orders where Order_ID = #value#
		</statement>	
		
		<statement id="GetOrderConstructor5"
			parameterClass="int"
			resultMap="order-result-constructor5">
			select * from Orders where Order_ID = #value#
		</statement>

    <statement id="GetOrderConstructor6"
      parameterClass="int"
      resultMap="order-result-constructor6">
      select * from Orders where Order_ID = #value#
    </statement>

    <statement id="GetOrderConstructor7"
      parameterClass="int"
      resultMap="order-result-constructor7">
      select * from Orders where Order_ID = #value#
    </statement>
    
    <select id="GetOrderConstructor8"
		parameterClass="Integer"
		resultMap="order-result-constructor8">
		  select 
			  Order_ID, 
			  Order_Date, 
			  Order_CardExpiry, 
			  Order_CardType,
			  Order_CardNumber, 
			  Order_Street, 
			  Order_City, 
			  Order_Province, 
			  Order_PostalCode,
			  acc.Account_ID,
			  acc.Account_FirstName,
			  acc.Account_LastName,
			  acc.Account_Email,
			  acc.Account_Banner_Option,
			  acc.Account_Cart_Option
		  from Orders as ord
		  LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
		  where Order_ID = #value#
	  </select>
	
	  <select id="GetOrderConstructor9" 
		  extends="GetOrderConstructor8"
		  parameterClass="Integer"
		  resultMap="order-joined-with-account-constructor">
	  </select>
    
    <select id="GetOrderConstructor10"
        parameterClass="Integer"
        resultMap="order-result-constructor9">
      select
      Order_ID,
      Order_Date,
      Order_CardExpiry,
      Order_CardType,
      Order_CardNumber,
      Order_Street,
      Order_City,
      Order_Province,
      Order_PostalCode,
      acc.Account_ID,
      acc.Account_FirstName,
      acc.Account_LastName,
      acc.Account_Email,
      acc.Account_Banner_Option,
      acc.Account_Cart_Option
      from Orders as ord
      LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
      where Order_ID = #value#
    </select>

    <select id="JIRA182"
    parameterClass="Integer"
    resultMap="order-JIRA182">
      select
      Order_ID,
      Order_Date,
      Order_CardExpiry,
      Order_CardType,
      Order_CardNumber,
      Order_Street,
      Order_City,
      Order_Province,
      Order_PostalCode,
      Account_ID
      from Orders
      where Order_ID = #value#
    </select>

  </statements>

	<parameterMaps>   
		
		<parameterMap id="insert-params" class="Order">
			<parameter property="Id" dbType="VarNumeric"/>	<!-- Int for SqlClient, Obdc; Integer for Oledb -->
			<parameter property="Account.Id"/>
			<parameter property="Date" nullValue="01/01/0001 00:00:00" />
			<parameter property="CardExpiry" />
			<parameter property="CardType" />			
			<parameter property="CardNumber" />
			<parameter property="Street" />
			<parameter property="City" />			
			<parameter property="Province" />
			<parameter property="PostalCode" />
		</parameterMap>
		
		<parameterMap id="params-parent" class="Order"> <!-- 1043181 support request -->
			<parameter property="Id" dbType="VarNumeric"/>	
			<parameter property="Account.Id"/>
			<parameter property="Date" nullValue="01/01/0001 00:00:00" />
			<parameter property="CardExpiry" />
			<parameter property="CardType" />			
			<parameter property="CardNumber" />
			<parameter property="Street" />
			<parameter property="City" />			
			<parameter property="Province" />
			<parameter property="PostalCode" />		
		</parameterMap>
		
		<parameterMap id="insert-extend" extends="params-parent" class="Order">
		</parameterMap>
		
	</parameterMaps>

</sqlMap>